home *** CD-ROM | disk | FTP | other *** search
/ CICA 1995 August / CICA - The Ultimate Collection of Shareware for Windows (Disc 2) (August 1995).iso / disc2 / demo / recdemo.exe / RECIPES.MS_ / RECIPES.bin
Text File  |  1993-09-01  |  22KB  |  722 lines

  1. '**************************************************************************
  2. '*                       RECIPES FOR WINDOWS V2.00
  3. '**************************************************************************
  4.  
  5. '$DEFINE DEBUG
  6.  
  7. '$INCLUDE 'setupapi.inc'
  8. '$INCLUDE 'msdetect.inc'
  9.  
  10. ''Dialog ID's
  11. CONST NEWINSTALL   = 101
  12. CONST ASKQUIT      = 200
  13. CONST RESTART      = 201
  14. CONST DESTPATH     = 300
  15. CONST EXITFAILURE  = 400
  16. CONST EXITQUIT     = 600
  17. CONST EXITSUCCESS  = 700
  18. CONST CHECK        = 2500
  19. CONST APPHELP      = 900
  20. CONST CUSTINST     = 6200
  21. CONST TOOBIG       = 6300
  22. CONST BADPATH      = 6400
  23.  
  24. ''Bitmap ID
  25. CONST LOGO         = 1
  26.  
  27. ''File Types
  28. CONST APPFILES     = 1
  29. CONST OPTFILES1    = 2
  30.  
  31.  
  32. GLOBAL AppName$    
  33. GLOBAL ExeName$    
  34. GLOBAL DEST$        
  35. GLOBAL OLDDEST$        
  36. GLOBAL DESTDATA$    
  37. GLOBAL WINDRIVE$    
  38. GLOBAL WINDIR$      
  39. GLOBAL WINSYSDIR$   
  40. GLOBAL SYSFILES$     
  41. GLOBAL szSYSFILES$     
  42.  
  43. ''CustInst list symbol names
  44. GLOBAL APPNEEDS$    ''Option list costs per drive
  45. GLOBAL CHK1NEEDS$
  46. GLOBAL EXTRACOSTS$  ''List of extra costs to add per drive
  47. GLOBAL BIGLIST$     ''List of option files cost calc results (boolean)
  48.  
  49. ''Dialog list symbol names
  50. GLOBAL CHECKSTATES$
  51. GLOBAL STATUSTEXT$
  52. GLOBAL DRIVETEXT$
  53.  
  54. const MaxNumOfFiles  = 60
  55. const MaxNumOfBuffers = 20
  56. const ConfigSys$         = "c:\config.sys"
  57. const ConfigBak$         = "c:\config.bak"
  58. const AutoBat$           = "c:\autoexec.bat"
  59. const AutoBak$           = "c:\autoexec.bak"
  60.  
  61. Rtn$ = Chr$(13)+Chr$(10)
  62. Q$   = Chr$(34)
  63.  
  64. GLOBAL UPDATENEW%
  65. GLOBAL NODELETE%
  66. CONST  NEW     = 1
  67. CONST  UPDATE  = 2
  68. UPDATENEW%     = NEW
  69. NODELETE%      = 0
  70.  
  71.  
  72. DECLARE SUB AddOptFilesToCopyList (ftype%)
  73. DECLARE SUB RecalcOptFiles (ftype%)
  74. DECLARE SUB RecalcPath
  75. DECLARE SUB SetDriveStatus
  76. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  77. DECLARE FUNCTION GetDrive (szPath$) AS STRING
  78.  
  79.  
  80.  
  81. INIT:
  82.     hinstOC% = LoadLibrary("OCCTRL20.DLL")
  83.     hinstCT% = LoadLibrary("CTL3D.DLL")
  84.     y% =  Ctl3dRegister(hinstCT%)
  85.     y% =  Ctl3dAutoSubClass(hinstCT%)
  86.     CUIDLL$ = "mscuistf.dll"            ''custom user interface dll
  87.     HELPPROC$ = "FHelpDlgProc"          ''Help dialog procedure
  88.  
  89.     AppName$ = "Recipes for Windows"
  90.     ExeName$ = "RECIPES.EXE"
  91.     DirName$ = "RECIPES2"
  92.     IniName$ = "RECIPES"
  93.     SetBitmap CUIDLL$, LOGO
  94.     SetTitle "Recipes for Windows"
  95.      Handle% = HwndFrame()
  96.      y% = ShowWindow(Handle%, 3)
  97.  
  98.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  99.     IF szInf$ = "" THEN
  100.         szInf$ = GetSymbolValue("STF_CWDDIR") + IniName$+".INF"
  101.     END IF
  102.     ReadInfFile szInf$
  103.  
  104.     WINSYSDIR$ = GetWindowsSysDir()
  105.     WINDIR$ = GetWindowsDir()
  106.     WINDRIVE$ = MID$(GetWindowsDir, 1, 1)
  107.     DEST$ = WINDRIVE$ + ":\"+DirName$
  108.     DESTDATA$ = WINDRIVE$ + ":\"+DirName$+"\DATA"
  109.  
  110.     ''CustInst list symbols
  111.     CHECKSTATES$ = "CheckItemsState"
  112.     STATUSTEXT$  = "StatusItemsText"
  113.     DRIVETEXT$   = "DriveStatusText"
  114.     FOR i% = 1 TO 2 STEP 1
  115.         AddListItem CHECKSTATES$, "ON"
  116.     NEXT i%
  117.     FOR i% = 1 TO 2 STEP 1
  118.          AddListItem STATUSTEXT$, ""
  119.     NEXT i%
  120.     FOR i% = 1 TO 7 STEP 1
  121.         AddListItem DRIVETEXT$, ""
  122.     NEXT i%
  123.     ReplaceListItem DRIVETEXT$, 7, DEST$
  124.  
  125.     ''Disk cost list symbols
  126.     APPNEEDS$   = "AppNeeds"
  127.     CHK1NEEDS$  = "Chk1Needs"
  128.     EXTRACOSTS$ = "ExtraCosts"
  129.     BIGLIST$    = "BigList"
  130.     FOR i% = 1 TO 2 STEP 1
  131.         AddListItem BIGLIST$, ""
  132.     NEXT i%
  133.     FOR i% = 1 TO 26 STEP 1
  134.         AddListItem EXTRACOSTS$, "0"
  135.     NEXT i%
  136.  
  137.     ''File Option Variables
  138.     sOPTION$ = "{""ON""}"
  139.     SYSFILES$ = "2"
  140.     szSYSFILES$ = "2"
  141.  
  142.      n% = DoesIniKeyExist("WIN.INI", AppName$, "EXEDIR")
  143.     IF n% = 1 THEN
  144.         TMP$ = GetIniKeyString("WIN.INI", AppName$ ,"EXEDIR")
  145.         IF TMP$ <> "" THEN
  146.             OLDDEST$ = UCASE$(TMP$)
  147.             OLDDEST$ = StripPath(OLDDEST$)
  148.         ENDIF
  149.         IF TMP$ = "" THEN
  150.             OLDDEST$ = DEST$
  151.             OLDDEST$ = StripPath(OLDDEST$)
  152.         ENDIF
  153.         UPDATENEW% = UPDATE
  154.     ENDIF
  155.     IF UPDATENEW% = UPDATE THEN
  156.         GOTO UPDATE
  157.     ELSE
  158.         RecalcPath
  159.         SetDriveStatus
  160.         GOTO CUSTINST
  161.     ENDIF
  162.  
  163. '$IFDEF DEBUG
  164.     i% = SetSizeCheckMode(scmOnIgnore)    '' could use scmOff; def = scmOnFatal
  165. '$ENDIF ''DEBUG
  166.  
  167.  
  168. UPDATE:
  169.   sz$ = UIStartDlg(CUIDLL$, NEWINSTALL, "FInfoDlgProc", APPHELP, HELPPROC$)
  170.   IF sz$ = "BACK" THEN
  171.     ''UPDATE 
  172.     UIPop 1
  173.     DEST$ = OLDDEST$
  174.     DESTDATA$ = DEST$+"\DATA"
  175.      NODELETE% = 1
  176.     ReplaceListItem DRIVETEXT$, 7, DEST$
  177.     RecalcPath
  178.     SetDriveStatus
  179.     GOTO CUSTINST
  180.   ELSEIF sz$ = "CONTINUE" THEN
  181.     ''NEW INSTALL DELETES ALL FILES RELATED TO RECIPES
  182.     UIPop 1
  183.     DEST$ = OLDDEST$
  184.     DESTDATA$ = DEST$+"\DATA"
  185.     ReplaceListItem DRIVETEXT$, 7, DEST$
  186.     RecalcPath
  187.     SetDriveStatus
  188.     GOTO CUSTINST
  189.   ELSE
  190.     GOSUB ASKQUIT
  191.     GOTO UPDATE
  192.   ENDIF
  193.  
  194. CUSTINST:
  195.     sz$ = UIStartDlg(CUIDLL$, CUSTINST, "FCustInstDlgProc", APPHELP, HELPPROC$)
  196.  
  197.     IF sz$ = "CONTINUE" THEN
  198.         ''Install only if it will fit.
  199.         FOR i% = 1 TO 2 STEP 1
  200.             IF GetListItem(BIGLIST$, i%) <> "" THEN
  201.                 GOSUB TOOBIG
  202.                 GOTO CUSTINST
  203.             END IF
  204.         NEXT i%
  205.         UIPop 1
  206.           IF (DEST$ = OLDDEST$) AND (NODELETE% = 0) THEN
  207.                CursorSave% = ShowWaitCursor()
  208.                 RemoveFile MakePath(DEST$,"CTL3D.DLL"),cmoForce
  209.                 RemoveFile MakePath(DEST$,"OCCTRL20.DLL"),cmoForce
  210.                 RemoveFile MakePath(DEST$,"PXENGWIN.DLL"),cmoForce
  211.                 RemoveFile MakePath(DEST$,"RECIPES.EXE"),cmoForce
  212.                 RemoveFile MakePath(DEST$,"RECIPES.HLP"),cmoForce
  213.                 RemoveFile MakePath(DEST$,"OCREPORT.DLL"),cmoForce
  214.                 RemoveFile MakePath(DEST$,"TBPRO1W.DLL"),cmoForce
  215.                 RemoveFile MakePath(DEST$,"TBPRO2W.DLL"),cmoForce
  216.                 RemoveFile MakePath(DEST$,"TBPRO3W.DLL"),cmoForce
  217.                 RemoveFile MakePath(DEST$,"TBPRO6W.DLL"),cmoForce
  218.  
  219.                 RemoveFile MakePath(WINSYSDIR$,"OCCTRL20.DLL"),cmoForce
  220.                 RemoveFile MakePath(WINSYSDIR$,"OCREPORT.DLL"),cmoForce
  221.                 RemoveFile MakePath(WINSYSDIR$,"TBPRO1W.DLL"),cmoForce
  222.                 RemoveFile MakePath(WINSYSDIR$,"TBPRO2W.DLL"),cmoForce
  223.                 RemoveFile MakePath(WINSYSDIR$,"TBPRO3W.DLL"),cmoForce
  224.                 RemoveFile MakePath(WINSYSDIR$,"TBPRO6W.DLL"),cmoForce
  225.                RestoreCursor CursorSave%
  226.           ENDIF
  227.           
  228.           IF ((GetListItem(CHECKSTATES$, APPFILES) = "ON") OR (GetListItem(CHECKSTATES$, OPTFILES1) = "ON")) THEN
  229.               GOTO INSTALL
  230.           ELSE
  231.              i% = DoMsgBox("You must have at least one option checked." , AppName$, MB_OK+MB_TASKMODAL+MB_ICONHAND)
  232.             GOTO CUSTINST
  233.           ENDIF
  234.     ELSEIF sz$ = "PATH" THEN
  235.         GOTO GETPATH
  236.     ELSEIF sz$ = "CHK1" THEN
  237.           IF GetListItem(CHECKSTATES$, APPFILES) = "ON" THEN
  238.             sOPTION$ = "{""ON""}"
  239.           ENDIF
  240.         RecalcOptFiles APPFILES
  241.         SetDriveStatus
  242.         GOTO CUSTINST
  243.     ELSEIF sz$ = "CHK2" THEN
  244.         RecalcOptFiles OPTFILES1
  245.         SetDriveStatus
  246.         GOTO CUSTINST
  247.     ELSEIF sz$ = "BTN1" THEN
  248.          GOTO APPFILES1
  249.     ELSEIF sz$ = "REACTIVATE" THEN
  250.         RecalcPath
  251.         SetDriveStatus
  252.         GOTO CUSTINST
  253.     ELSE
  254.         GOSUB ASKQUIT
  255.         GOTO CUSTINST
  256.     END IF
  257.  
  258.  
  259.  
  260. INSTALL:
  261.  
  262.      ClearCopyList
  263.     AddOptFilesToCopyList APPFILES
  264.     AddOptFilesToCopyList OPTFILES1
  265.     ''SetCopyGaugePosition 210,250
  266.  
  267.      
  268.     IF GetListItem(CHECKSTATES$, APPFILES) = "ON" THEN
  269.              
  270.              DirExist% = DoesDirExist(DEST$)
  271.             IF DirExist% = 1 THEN
  272.                 i% = DoMsgBox("This directory " + DEST$ +" already exists. Do you want to overwrite it?", AppName$, MB_YESNO+MB_TASKMODAL+MB_ICONHAND)
  273.                 IF i% = 7 THEN
  274.                    GOTO CUSTINST
  275.                 END IF
  276.             END IF   
  277.         
  278.     END IF
  279.      
  280.     IF GetListItem(CHECKSTATES$, OPTFILES1) = "ON" THEN
  281.             DirExist% = DoesDirExist(DESTDATA$)
  282.             IF DirExist% = 1 THEN
  283.                 i% = DoMsgBox("This directory " + DESTDATA$ + " already exists. Do you want to overwrite it?  If you choose YES, all of your data will be lost.", AppName$, MB_YESNO+MB_TASKMODAL+MB_ICONHAND)
  284.                 IF i% = 7 THEN
  285.                    GOTO CUSTINST
  286.                 END IF
  287.             END IF   
  288.      END IF
  289.      
  290.      
  291.     CreateDir DEST$, cmoNone
  292.     CreateDir DESTDATA$, cmoNone
  293.     FileName$ = DESTDATA$ + "\RECIPES.PX"
  294.     FileExist% = DoesFileExist(FileName$, femExists)
  295.     IF FileExist% = 1 THEN
  296.        RemoveFile FileName$, cmoNone
  297.     END IF   
  298.     FileName$ = DESTDATA$ + "\_RECIPES.PX"
  299.     FileExist% = DoesFileExist(FileName$, femExists)
  300.     IF FileExist% = 1 THEN
  301.        RemoveFile FileName$, cmoNone
  302.     END IF   
  303.     FileName$ = DESTDATA$ + "\COUPONS.PX"
  304.     FileExist% = DoesFileExist(FileName$, femExists)
  305.     IF FileExist% = 1 THEN
  306.        RemoveFile FileName$, cmoNone
  307.     END IF   
  308.     FileName$ = DESTDATA$ + "\PANTRY.PX"
  309.     FileExist% = DoesFileExist(FileName$, femExists)
  310.     IF FileExist% = 1 THEN
  311.        RemoveFile FileName$, cmoNone
  312.     END IF   
  313.     FileName$ = DESTDATA$ + "\RESTAUR.PX"
  314.     FileExist% = DoesFileExist(FileName$, femExists)
  315.     IF FileExist% = 1 THEN
  316.        RemoveFile FileName$, cmoNone
  317.     END IF   
  318.     FileName$ = DESTDATA$ + "\LAYOUT.PX"
  319.     FileExist% = DoesFileExist(FileName$, femExists)
  320.     IF FileExist% = 1 THEN
  321.        RemoveFile FileName$, cmoNone
  322.     END IF   
  323.     FileName$ = DESTDATA$ + "\USERLIST.PX"
  324.     FileExist% = DoesFileExist(FileName$, femExists)
  325.     IF FileExist% = 1 THEN
  326.        RemoveFile FileName$, cmoNone
  327.     END IF   
  328.     FileName$ = DESTDATA$ + "\SHOPLIST.PX"
  329.     FileExist% = DoesFileExist(FileName$, femExists)
  330.     IF FileExist% = 1 THEN
  331.        RemoveFile FileName$, cmoNone
  332.     END IF   
  333.     FileName$ = DESTDATA$ + "\SHOPITEM.PX"
  334.     FileExist% = DoesFileExist(FileName$, femExists)
  335.     IF FileExist% = 1 THEN
  336.        RemoveFile FileName$, cmoNone
  337.     END IF   
  338.     CopyFilesInCopyList
  339.     
  340.      IF GetListItem(CHECKSTATES$, APPFILES) = "ON" THEN
  341.           FileName$ = WINDIR$ + IniName$+".INI"
  342.           FileExist% = DoesFileExist(FileName$, femExists)
  343.           IF FileExist% = 1 THEN
  344.         CopyFile FileName$, DEST$+"\"+IniName$+".INI", cmoNone, 0
  345.                RemoveFile FileName$, cmoNone
  346.           END IF   
  347.          
  348.     WinINI$ = MakePath(WINDIR$, "WIN.INI")
  349.         CreateIniKeyValue WinINI$, AppName$, "DATADIR", DESTDATA$+"\", cmoOverwrite
  350.         CreateIniKeyValue WinINI$, AppName$, "EXEDIR", DEST$+"\", cmoOverwrite
  351.  
  352.     ini$ = MakePath(DEST$, IniName$+".INI")
  353.         CreateIniKeyValue ini$, "Directories", "Data", DESTDATA$+"\", cmoOverwrite
  354.         ini$ = ""
  355.         OTHER$ = Q$+Q$+","+Q$+Q$+","+Q$+Q$+","+Q$+Q$+DESTDATA$
  356.     CreateProgmanGroup AppName$, "", cmoNone
  357.         ShowProgmanGroup  AppName$, 1, cmoNone
  358.         CreateProgmanItem AppName$, "Recipes 2.0", MakePath(DEST$, ExeName$), OTHER$, cmoOverwrite
  359.         CreateProgmanItem AppName$, "Late Breaking News", "notepad.exe "+MakePath(DEST$,"readme.txt"), "", cmoOverwrite
  360.     END IF
  361.  
  362. QUIT:
  363.     ON ERROR GOTO ERRQUIT
  364.  
  365.     IF ERR = 0 THEN
  366.         dlg% = EXITSUCCESS
  367.     ELSEIF ERR = STFQUIT THEN
  368.         dlg% = EXITQUIT
  369.     ELSE
  370.         dlg% = EXITFAILURE
  371.     END IF
  372. QUITL1:
  373.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  374.     IF sz$ = "REACTIVATE" THEN
  375.         GOTO QUITL1
  376.     END IF
  377.     UIPop 1
  378.     
  379.      '' Find number of files in config.sys
  380.      if (GetConfigNumFiles < MaxNumOfFiles) OR (GetConfigNumBuffers < MaxNumOfBuffers) then
  381.         
  382.         Rc% = UpdateConfigSys(ConfigSys$, ConfigBak$, MaxNumOfFiles, MaxNumOfBuffers)
  383.         if Rc% = 0 then
  384.                i% = DoMsgBox("Failed to update CONFIG.SYS.", AppName$, MB_OK+MB_TASKMODAL+MB_ICONINFORMATION)
  385.         else
  386.                Msg$ = "Your CONFIG.SYS has been modified. The original has been renamed to CONFIG.BAK." + Rtn$ 
  387.             Msg$ = Msg$ + "RESTART your machine for the changes to take effect."
  388.                i% = DoMsgBox(Msg$, AppName$, MB_OK+MB_TASKMODAL+MB_ICONINFORMATION)
  389.         end if
  390.      
  391.      end if
  392.     
  393.     
  394.      '' Find if share.exe is loaded
  395.      InstallDrive$ = GetDrive(DEST$)
  396.      if IsDriveNetwork(InstallDrive$) = 0 then
  397.         '' This is a local drive
  398.         
  399.         if IsShareInstalled(AutoBat$) = 0 then
  400.             '' Share is not installed
  401.             InstallDrive$ = InstallDrive$ +":\"
  402.             SharePath$ = FindFileInTree("SHARE.EXE", InstallDrive$)
  403.             if SharePath$ = "" then
  404.                i% = DoMsgBox("SHARE.EXE can not be found. Please make sure that SHARE.EXE is loaded before running "+AppName$+".", AppName$, MB_OK+MB_TASKMODAL+MB_ICONINFORMATION)
  405.             else                     
  406.                   Rc% = AddShareToAutoExec(AutoBat$, AutoBak$, SharePath$) 
  407.                   if Rc% = 0 then                     
  408.                    i% = DoMsgBox("Failed to update AUTOEXEC.BAT.", AppName$, MB_OK+MB_TASKMODAL+MB_ICONINFORMATION)
  409.                 else
  410.                     Msg$ = "Your AUTOEXEC.BAT has been modified. The original has been renamed to AUTOEXEC.BAK." + Rtn$
  411.                     Msg$ = Msg$ + "RESTART your machine for the changes to take effect."
  412.                        i% = DoMsgBox(Msg$, AppName$, MB_OK+MB_TASKMODAL+MB_ICONINFORMATION)
  413.                   end if
  414.             end if         
  415.             
  416.         end if            
  417.         
  418.      end if
  419.     
  420.      IF dlg% = EXITSUCCESS Then
  421.          Readme$ = "notepad.exe " + DEST$ + "\" + "readme.txt"
  422.      i% = DoMsgBox("Would you like to view the README file.", AppName$, MB_YESNO+MB_TASKMODAL+MB_ICONINFORMATION)
  423.      IF i% = 6 THEN
  424.         Rc% = WinExec(README$, 1)
  425.          END IF
  426.      END IF
  427.      
  428.     y% = Ctl3dUnRegister(hinstCT%)
  429.     FreeLibrary(hinstCT%)
  430.      FreeLibrary(hinstOC%)
  431.     
  432.     END
  433.  
  434. ERRQUIT:
  435.     i% = DoMsgBox("Setup sources were corrupted, call (619) 929-7833!", AppName$, MB_OK+MB_TASKMODAL+MB_ICONHAND)
  436.     END
  437.  
  438.  
  439.  
  440. GETPATH:
  441.     SetSymbolValue "EditTextIn", DEST$
  442.     SetSymbolValue "EditFocus", "END"
  443. GETPATHL1:
  444.     sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
  445.     
  446.     IF sz$ = "CONTINUE" THEN
  447.         olddest$ = DEST$
  448.         DEST$ = GetSymbolValue("EditTextOut")
  449.  
  450.         ''Validate new path.
  451.         IF IsDirWritable(DEST$) = 0 THEN
  452.             GOSUB BADPATH
  453.             DEST$ = olddest$
  454.                 GOTO GETPATHL1
  455.         END IF
  456.         UIPop 1
  457.  
  458.         ''Truncate display if too long.
  459.         IF LEN(DEST$) > 23 THEN
  460.             ReplaceListItem DRIVETEXT$, 7, MID$(DEST$, 1, 23)+"..."
  461.         ELSE
  462.             ReplaceListItem DRIVETEXT$, 7, DEST$
  463.         END IF
  464.  
  465.         ''Recalc if path changed.
  466.         IF (olddest$ <> DEST$) AND (olddest$ <> DEST$+"\") AND (olddest$+"\" <> DEST$) THEN
  467.             RecalcPath
  468.             SetDriveStatus
  469.         END IF
  470.  
  471.         olddest$ = ""
  472.          DESTDATA$ = DEST$+"\DATA"
  473.         GOTO CUSTINST
  474.     ELSEIF sz$ = "BACK" THEN
  475.         RecalcPath
  476.         SetDriveStatus
  477.         UIPop 1
  478.         GOTO CUSTINST
  479.     ELSEIF sz$ = "REACTIVATE" THEN
  480.         RecalcPath
  481.         SetDriveStatus
  482.         GOTO GETPATHL1
  483.     ELSEIF sz$ = "EXIT" THEN
  484.         GOSUB ASKQUIT
  485.         GOTO GETPATHL1
  486.     ELSE
  487.         UIPop 1
  488.         GOTO CUSTINST
  489.     END IF
  490.  
  491.  
  492. APPFILES1:
  493.      IF GetListItem(CHECKSTATES$, APPFILES) = "ON" THEN
  494.             SetSymbolValue "CheckItemsIn", sOPTION$
  495.      ELSE
  496.             SetSymbolValue "CheckItemsIn", ""
  497.      ENDIF
  498. APPL1:
  499.     sz$ = UIStartDlg(CUIDLL$, CHECK, "FCheckDlgProc", APPHELP, HELPPROC$)
  500.     newopt$ = GetSymbolValue("CheckItemsOut")
  501.  
  502.     IF sz$ = "CONTINUE" THEN
  503.          UIPop 1
  504.          szSYSFILES$ = GetListItem("CheckItemsOut",1)
  505.           x$ = ""
  506.           IF szSYSFILES$ = "OFF" THEN
  507.             szSYSFILES$ = "1"
  508.                 x$ = "ON"
  509.             ELSE
  510.             szSYSFILES$ = ""
  511.           END IF
  512.  
  513.         RecalcOptFiles APPFILES
  514.         SetDriveStatus
  515.         newopt$ = ""
  516.         GOTO CUSTINST
  517.     ELSEIF sz$ = "REACTIVATE" THEN
  518.         RecalcPath
  519.         SetDriveStatus
  520.         GOTO APPL1
  521.     ELSEIF sz$ = "EXIT" THEN
  522.         GOSUB ASKQUIT
  523.         GOTO APPL1
  524.     ELSE
  525.         UIPop 1
  526.         newopt$ = ""
  527.         GOTO CUSTINST
  528.     END IF
  529.  
  530.  
  531. TOOBIG:
  532.     sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfo0DlgProc", 0, "")
  533.     IF sz$ = "REACTIVATE" THEN
  534.         RecalcPath
  535.         SetDriveStatus
  536.         GOTO TOOBIG
  537.     END IF
  538.     UIPop 1
  539.     RETURN
  540.  
  541.  
  542.  
  543. BADPATH:
  544.     sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  545.     IF sz$ = "REACTIVATE" THEN
  546.         RecalcPath
  547.         SetDriveStatus
  548.         GOTO BADPATH
  549.     END IF
  550.     UIPop 1
  551.     RETURN
  552.  
  553. ASKQUIT:
  554.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  555.  
  556.     IF sz$ = "EXIT" THEN
  557.         UIPopAll
  558.         ERROR STFQUIT
  559.     ELSEIF sz$ = "REACTIVATE" THEN
  560.         GOTO ASKQUIT
  561.     ELSE
  562.         UIPop 1
  563.     END IF
  564.     RETURN
  565.  
  566. '**
  567. '** Purpose:
  568. '**     Adds the specified option files to the copy list.
  569. '** Arguments:
  570. '**     ftype%  - type of files to add, one of the following:
  571. '** Returns:
  572. '**     none.
  573. '*************************************************************************
  574. SUB AddOptFilesToCopyList (ftype%) STATIC
  575.  
  576.     IF GetListItem(CHECKSTATES$, ftype%) = "ON" THEN
  577.         SrcDir$ = GetSymbolValue("STF_SRCDIR")
  578.         IF ftype% = APPFILES THEN
  579.             AddSectionFilesToCopyList "AppFiles", SrcDir$, DEST$
  580.             IF szSYSFILES$ = "1" THEN
  581.                     AddSectionFilesToCopyList "SysFiles", SrcDir$, DEST$
  582.                 ELSE
  583.                 AddSectionFilesToCopyList "SysFiles", SrcDir$, WINSYSDIR$
  584.                 ENDIF
  585.         ELSEIF ftype% = OPTFILES1 THEN
  586.             AddSectionFilesToCopyList "DataFiles", SrcDir$, DESTDATA$
  587.         END IF
  588.         SrcDir$ = ""
  589.     END IF
  590. END SUB
  591.  
  592.  
  593. '**
  594. '** Purpose:
  595. '**     Recalculates disk space for the given option files and sets
  596. '**     the status info symbol "StatusItemsText".
  597. '** Returns:
  598. '**     none.
  599. '*************************************************************************
  600. SUB RecalcOptFiles (ftype%) STATIC
  601.     CursorSave% = ShowWaitCursor()
  602.     ClearCopyList
  603.     AddOptFilesToCopyList ftype%
  604.  
  605.     fExtra% = 0
  606.     IF ftype% = APPFILES THEN
  607.         ListSym$ = APPNEEDS$
  608.         IF GetListItem(CHECKSTATES$, APPFILES) = "ON" THEN
  609.             ''Add extra cost to Windows drive for ini/progman, etc.
  610.             ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  611.             ReplaceListItem EXTRACOSTS$, ndrive%, "10240"
  612.             fExtra% = 1
  613.         END IF
  614.     ELSEIF ftype% = OPTFILES1 THEN
  615.         ListSym$ = CHK1NEEDS$
  616.         IF GetListItem(CHECKSTATES$, OPTFILES1) = "ON" THEN
  617.             ''Add extra cost to Windows drive for ini/progman, etc.
  618.             ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  619.             ReplaceListItem EXTRACOSTS$, ndrive%, "10240"
  620.             fExtra% = 1
  621.         END IF
  622.     END IF
  623.  
  624.     StillNeed& = GetCopyListCost(EXTRACOSTS$, ListSym$, "")
  625.  
  626.     cost& = 0
  627.     FOR i% = 1 TO 26 STEP 1
  628.         cost&  = cost& + VAL(GetListItem(ListSym$, i%))
  629.     NEXT i%
  630.     ReplaceListItem STATUSTEXT$, ftype%, STR$(cost& / 1024) + " K"
  631.  
  632.     IF StillNeed& > 0 THEN
  633.         ReplaceListItem BIGLIST$, ftype%, "YES"
  634.     ELSE
  635.         ReplaceListItem BIGLIST$, ftype%, ""
  636.     END IF
  637.  
  638.     IF fExtra% THEN
  639.         ReplaceListItem EXTRACOSTS$, ndrive%, "0"
  640.     END IF
  641.     RestoreCursor CursorSave%
  642.     ListSym$ = ""
  643. END SUB
  644.  
  645.  
  646. '**
  647. '** Purpose:
  648. '**     Recalculates disk space and sets option status info according
  649. '**     to the current destination path.
  650. '*************************************************************************
  651. SUB RecalcPath STATIC
  652.  
  653.     CursorSave% = ShowWaitCursor()
  654.  
  655.     RecalcOptFiles APPFILES
  656.     RecalcOptFiles OPTFILES1
  657.  
  658.     RestoreCursor CursorSave%
  659. END SUB
  660.  
  661.  
  662. '**
  663. '** Purpose:
  664. '**     Sets drive status info according to latest disk space calcs.
  665. '*************************************************************************
  666. SUB SetDriveStatus STATIC
  667.  
  668.     drive$ = MID$(DEST$, 1, 1)
  669.     ndrive% = ASC(ucase$(drive$)) - ASC("A") + 1
  670.     cost& = VAL(GetListItem(APPNEEDS$, ndrive%)) + VAL(GetListItem(CHK1NEEDS$, ndrive%))
  671.     free& = GetFreeSpaceForDrive(drive$)
  672.     ReplaceListItem DRIVETEXT$, 1, drive$ + ":"
  673.     ReplaceListItem DRIVETEXT$, 2, STR$(cost& / 1024) + " K"
  674.     ReplaceListItem DRIVETEXT$, 3, STR$(free& / 1024) + " K"
  675.  
  676.     IF drive$ = WINDRIVE$ THEN
  677.         ReplaceListItem DRIVETEXT$, 4, ""
  678.         ReplaceListItem DRIVETEXT$, 5, ""
  679.         ReplaceListItem DRIVETEXT$, 6, ""
  680.     ELSE
  681.         ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  682.         cost& = VAL(GetListItem(APPNEEDS$, ndrive%)) + VAL(GetListItem(CHK1NEEDS$, ndrive%)) 
  683.         IF cost& = 0 THEN
  684.             ReplaceListItem DRIVETEXT$, 4, ""
  685.             ReplaceListItem DRIVETEXT$, 5, ""
  686.             ReplaceListItem DRIVETEXT$, 6, ""
  687.         ELSE
  688.             free& = GetFreeSpaceForDrive(WINDRIVE$)
  689.             ReplaceListItem DRIVETEXT$, 4, WINDRIVE$ + ":"
  690.             ReplaceListItem DRIVETEXT$, 5, STR$(cost& / 1024) + " K"
  691.             ReplaceListItem DRIVETEXT$, 6, STR$(free& / 1024) + " K"
  692.         END IF
  693.     END IF
  694. END SUB
  695.  
  696.  
  697. '**
  698. '** Purpose:
  699. '**     Appends a file name to the end of a directory path,
  700. '**     inserting a backslash character as needed.
  701. '** Arguments:
  702. '**     szDir$  - full directory path (with optional ending "\")
  703. '**     szFile$ - filename to append to directory
  704. '** Returns:
  705. '**     Resulting fully qualified path name.
  706. '*************************************************************************
  707. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  708.     IF szDir$ = "" THEN
  709.         MakePath = szFile$
  710.     ELSEIF szFile$ = "" THEN
  711.         MakePath = szDir$
  712.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  713.         MakePath = szDir$ + szFile$
  714.     ELSE
  715.         MakePath = szDir$ + "\" + szFile$
  716.     END IF
  717. END FUNCTION
  718.  
  719. FUNCTION GetDrive (szPath$) STATIC AS STRING
  720.     GetDrive = MID$( szPath$, 1, 1)
  721. END FUNCTION
  722.